<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePerformanceLevelsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('performance_levels', function (Blueprint $table) {
            $table->id();
            $table->string('name')->comment('等级名称（如V1/V2）');
            $table->decimal('min_amount', 15, 2)->comment('最小金额');
            $table->decimal('max_amount', 15, 2)->comment('最大金额');
            $table->decimal('new_order_rate', 5, 2)->comment('新增订单奖励比例');
            $table->json('peer_rates')->comment('平级奖励比例 {1:5, 2:3}');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `performance_levels` comment '业绩等级'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('performance_levels');
    }
}
